function formCheck(f){//f-submit이 발생한 form객체
	var id = f.id.value.trim();//trim 옛 브라우저 버전에서는 사용불가
	var password = f.password.value.trim();
	var name = f.name.value.trim();
	var age = f.age.value.trim();
	var gender = f.gender;
	
	
	var addr1 = f.addr1.value.trim();
	var addr2 = f.addr2.value.trim();
	document.getElementById("address").value = addr1 +"/"+ addr2;
	
	var zipCode1 = f.zipCode1.value.trim();
	var zipCode2 = f.zipCode2.value.trim();
	document.getElementById("zipCode").value = zipCode1 +"-"+ zipCode2;
	
	
	var year = f.year.value.trim();
	var month = f.month.value.trim();
	var day = f.day.value.trim();
	document.getElementById("birthDate").value = year+"-"+month+"-"+day;
	
	
	var email1 = f.email1.value.trim();
	var email2 = f.email2.value.trim();
	document.getElementById("email").value = email1+"@"+email2;
	
	
	var homePhone1 = f.homePhone1.value.trim();
	var homePhone2 = f.homePhone2.value.trim();
	var homePhone3 = f.homePhone3.value.trim();
	document.getElementById("homePhone").value = homePhone1+"-"+homePhone2+"-"+homePhone3;
	
	
	var cellPhone1 = f.cellPhone1.value.trim();
	var cellPhone2 = f.cellPhone2.value.trim();
	var cellPhone3 = f.cellPhone3.value.trim();
	document.getElementById("cellPhone").value = cellPhone1+"-"+cellPhone2+"-"+cellPhone3;
	
	
	var SNSReception = f.SNSReception;
	var emailReception = f.emailReception;
	
	
	//자바크립트 if문 조건에는 - 문자열("" : false), 숫자(0 : false),  객체null(false), undefined(false) 가능
	if(!id){
		alert("ID를 입력하세요");
		f.id.value="";
		f.id.focus();
		return false;
	}
	if(!password){
		alert("password를 입력하세요");
		f.password.value="";
		f.password.focus();
		return false;
	} 
	if(!password2){
		alert("password확인을 입력하세요");
		f.password.value="";
		f.password.focus();
		return false;
	}
	if(!name){
		alert("이름을 입력하세요");
		f.name.value="";
		f.name.focus();
		return false;
	}
	if(!age){
		alert("나이를 입력하세요");
		f.age.value="";
		f.age.focus();
		return false;
	}
	if(gender == null){
		alert("성별을 선택하세요");
		f.gender.value="";
		f.gender.focus();
		return false;
	}
	if(!zipCode1){
		alert("우푠번호를 입력하세요");
		f.zipCode1.value="";
		f.zipCode1.focus();
		return false;
	}
	if(!zipCode2){
		alert("우푠번호를 입력하세요");
		f.zipCode2.value="";
		f.zipCode2.focus();
		return false;
	}
	if(!addr1){
		alert("주소를 입력하세요");
		f.addr1.value="";
		f.addr1.focus();
		return false;
	}
	if(!addr2){
		alert("상세주소를 입력하세요");
		f.addr2.value="";
		f.addr2.focus();
		return false;
	}
	if(!year){
		alert("년도를 선택하세요");
		f.year.value="";
		f.year.focus();
		return false;
	}
	if(!month){
		alert("달을 선택하세요");
		f.month.value="";
		f.month.focus();
		return false;
	}
	if(!day){
		alert("일을 선택하세요");
		f.day.value="";
		f.day.focus();
		return false;
	}
	if(!email){
		alert("email을 입력하세요");
		f.email.value="";
		f.email.focus();
		return false;
	}
	if(!cellPhone){
		alert("휴대폰 번호를 입력하세요");
		f.homePhone.value="";
		f.homePhone.focus();
		return false;
	}
	if(!SNSReception){
		alert("SNS수신여부를 선택하세요");
		f.SNSReception.value="";
		f.SNSReception.focus();
		return false;
	}
	if(!emailReception){
		alert("email수신여부를 선택하세요");
		f.emailReception.value="";
		f.emailReception.focus();
		return false;
	}
}

//주소검색
function findAddress(){
	new daum.Postcode({
		oncomplete: function(data){
			document.getElementById('zipCode1').value = data.postcode1;
			document.getElementById('zipCode2').value = data.postcode2;
			document.getElementById('addr1').value = data.address;
			document.getElementById('addr2').focus();
			
		}
	}).open();
};

//회원가입 아이디가 영어, 숫자만 입력가능
function checkId() {
	var eng_check = /^[A-Za-z0-9+]*$/;
	var userid = document.getElementById("id").value;
	if (eng_check.test(userid) != true) {
		document.getElementById("id_error").innerHTML = "영어, 숫자만 입력 가능합니다.";
		document.getElementById("id_error").style.color = "red";
		document.getElementById("id").value = "";
	} else {
		document.getElementById("id_error").innerHTML = "";
	}
}

//회원가입 아이디체크
function checkEng(){
	var t_length = document.getElementById("id").value.length; 
	
	if(t_length < 5 ){
		document.getElementById("id_error").innerHTML = "5~16자리 사이로 입력 하셔야됩니다.";
		document.getElementById("id_error").style.color = "red";
		document.getElementById("id").value = "";
		
	}else{
		
		$.ajax({
			type: "post",
			url : "/must_go/membership/membershipIdCheck.do",
			data:{"id" : document.getElementById("id").value},
			dataType:"JSON",
			"success" : function(json){
				if(json.membership){
					$("#id_error").html("아이디가 존재합니다.").css({
						"color" : "red"
					});
					document.getElementById("id").value = "";
				}else{
					$("#id_error").html("사용가능한 아이디 입니다.").css({
						"color" : "blue"
					});
				}
			},

		});
	}
	
}

//비밀번호 길이 체크
function pwlengthcheck() {
	
	if ((document.getElementById("password").value.length) <= 5) {
		document.getElementById("password_error").innerHTML = "6자 이상 입력하세요.";
		document.getElementById("password_error").style.color = "red";
		document.getElementById("password").value = "";
	}
}

//비밀번호 확인
function pwcheck() {
	var userPw = document.getElementById("password").value;
	var userPwc = document.getElementById("password2").value;

	if (((document.getElementById("password").value.length) == 0)) {
		document.getElementById("password_error").innerHTML = "비밀번호를 입력하세요.";
		document.getElementById("password_error").style.color = "red";

		return false;
	} else {
		document.getElementById("password_error").innerHTML = "";
	}

	if (((document.getElementById("password2").value.length) == 0)
			|| userPw != userPwc) {

		document.getElementById("password2").value = "";
		document.getElementById("password_error").innerHTML = "비밀번호가 다릅니다.";
		document.getElementById("password_error").style.color = "red";

		return false;
	} else {
		document.getElementById("password_error").innerHTML = "";
	}
}

//이름에 한글만 입력가능
function checkKor() {
	var kor_check = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i;

	var username = document.getElementById("name").value;
	if (kor_check.test(username) != false) {
		document.getElementById("name_error").innerHTML = "한글만 입력 가능합니다.";
		document.getElementById("name_error").style.color = "red";
		document.getElementById("name").value = "";
	}
	else {
		document.getElementById("name_error").innerHTML = "";
	}
}

//나이에 숫자만 입력가능
function checkNum() {

	var munber_check = /^[0-9+]*$/;
	var userage = document.getElementById("age").value;
	if (munber_check.test(userage) == false) {
		document.getElementById("age_error").innerHTML = "숫자만 입력 가능합니다.";
		document.getElementById("age_error").style.color = "red";
		document.getElementById("age").value = "";
	}
	else {
		document.getElementById("age_error").innerHTML = "";
	}
}


//전화번호에 숫자만 입력가능
function checkNum2() {

	var munber_check = /^[0-9+]*$/;
	var userhomephone2 = document.getElementById("homePhone2").value;
	var userhomephone3 = document.getElementById("homePhone3").value;
	if (munber_check.test(userhomephone2) == false || munber_check.test(userhomephone3) == false) {
		document.getElementById("homePhone_error").innerHTML = "숫자만 입력 가능합니다.";
		document.getElementById("homePhone_error").style.color = "red";
		document.getElementById("homePhone3").value = "";
	}
	else {
		document.getElementById("homePhone_error").innerHTML = "";
	}
}


//휴대폰에 숫자만 입력가능
function checkNum3() {

	var munber_check = /^[0-9+]*$/;
	var usercellphone2 = document.getElementById("cellPhone2").value;
	var usercellphone3 = document.getElementById("cellPhone3").value;
	if (munber_check.test(usercellphone2) == false || munber_check.test(usercellphone3) == false) {
		document.getElementById("cellPhone_error").innerHTML = "숫자만 입력 가능합니다.";
		document.getElementById("cellPhone_error").style.color = "red";
		document.getElementById("cellPhone3").value = "";
	}
	else {
		document.getElementById("cellPhone_error").innerHTML = "";
	}
}


//email 처리
function emailCheck() {
	var kor_check = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i;

	var userEmail = document.getElementById("email1").value;
	if (kor_check.test(userEmail) == false) {
		document.getElementById("email_error").innerHTML = "영어, 숫자만 입력하세요.";
		document.getElementById("email_error").style.color = "red";
		document.getElementById("email1").value = "";
	} else {
		document.getElementById("email_error").innerHTML = "";
	}
}
function emailCheck2() {
	var kor_check = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i;

	var userEmail = document.getElementById("email2").value;
	if (kor_check.test(userEmail) == false) {
		document.getElementById("email_error").innerHTML = "영어, 숫자만 입력하세요.";
		document.getElementById("email_error").style.color = "red";
		document.getElementById("email2").value = "";
	} else {
		document.getElementById("email_error").innerHTML = "";
	}
}

function emailmsgclear() {
	document.getElementById("email_error").innerHTML = "";
}




 function monthChange(){
		
		var month = window.parseInt($("#month").val());
		var endDay =0;
		var isNum = window.isNaN($("#month").val());
		
		
		if(isNum){
			$("#day").html("<option>일선택</option>") ;
		}else{
			switch (month) {
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:
				endDay = 31;
				break;
			case 2:
				endDay =29;
				break;
			default:
				endDay =30;
			}
			var txt = "<option>일선택</option>";
			for(var i=1; i<=endDay; i++){
				txt=txt+"<option>"+i+"</option>";
			}
			$("#day").html(txt);
		}
	};



























